package com.liao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liao.model.po.MovieRole;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 用户权限 Mapper 接口
 * </p>
 *
 * @author liao
 */
public interface MovieRoleMapper extends BaseMapper<MovieRole> {


    /**
     * 根据用户id获取权限
     * @param userId 用户id
     * @return
     */
    @Select("SELECT movie_role.perms\n" +
            "FROM movie_users\n" +
            "JOIN user_role ON movie_users.id = user_role.id \n" +
            "left JOIN movie_role ON  user_role.id  = movie_role.id \n" +
            "WHERE movie_users.id =#{userId};")
    List<String> selectPermsByUserId(@Param("userId")Long userId);
}
